package com.xmall.order.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xmall.order.define.dict.AfterSaleStatusEnum;
import com.xmall.define.dict.OrderStatusEnum;
import com.xmall.order.define.dto.OrderDtoWithCascade;
import com.xmall.define.dto.order.OrderDto;
import com.xmall.define.dto.product.SkuQuantity;
import com.xmall.order.define.dto.*;
import com.xmall.order.define.dto.OrderConfirmResponseDto;
import com.xmall.order.define.request.api.OrderConfirmRequest;
import com.xmall.order.define.request.api.OrderSubmitRequest;
import com.xmall.order.entity.Order;
import com.xmall.order.entity.OrderPaySuccessRetryLog;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author xmall
 * @since 2023-11-19
 */
public interface IOrderService extends IService<Order> {

    /**
     * 库存检查
     */
    List<Long> stockCheck(List<SkuQuantity> skuQuantityList);

    /**
     * 订单确认
     */
    OrderConfirmResponseDto confirm(OrderConfirmRequest request);

    /**
     * 提交订单
     */
    Long submit(OrderSubmitRequest request);

    /**
     * 订单支付检查
     */
    void payCheck(Long orderId);

    /**
     * 更新订单状态
     */
    void updateOrderStatus(Long orderId, OrderStatusEnum orderStatusEnum);

    /**
     * 更新订单状态
     */
    void updateOrderStatusStrict(Long orderId, OrderStatusEnum preOrderStatusEnum, OrderStatusEnum newOrderStatusEnum);

    /**
     * 取消订单
     */
    void cancelOrder(Long id);

    /**
     * 支付成功
     */
    void paySuccess(OrderPaySuccessRetryLog log);

    /**
     * 确认收货
     */
    void takeDelivery(Long id);

    /**
     * 删除订单
     */
    void deleteOrder(Long id);

    /**
     * 设置订单售后状态
     */
    void setOrderAfterSaleStatus(Long orderId, AfterSaleStatusEnum afterSaleStatusEnum);

    /**
     * 设置订单子项售后状态
     */
    void setOrderItemAfterSaleStatusByOrderId(Long orderId, AfterSaleStatusEnum afterSaleStatusEnum);

    /**
     * 设置订单子项售后状态
     */
    void setOrderItemAfterSaleStatus(Long orderItemId, AfterSaleStatusEnum afterSaleStatusEnum);

    /**
     * 详情
     */
    OrderDto info(Long id);

    /**
     * 详情
     */
    OrderDtoWithCascade infoWithCascade(Long id);

    /**
     * 自定义分页查询
     */
    Page<OrderDtoWithCascade> listPageWithCascade(Page page, OrderQueryParams query);

}
